Skip to content

foreach-index-key: cut review-constructed source shapes - #41

Merged
bahbyega merged 12 commits into
mainfrom
compact-foreach-index-key
Nov 26, 2026
Merged

bahbyega merged 12 commits into
mainfrom
compact-foreach-index-key

Conversation

@bahbyega

@bahbyega bahbyega commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

Compacts R1 foreach-index-key (#37). Under AI review its source grew from +317 to +900 lines. Each comment named another syntactic variant, each was fixed, and each fix invited the next. This PR cuts the variants that real list code rarely writes. Each cut case falls back to what the first-review version did: it reports, or stays quiet, as the simpler code decides. Common shapes stay covered: filtered and sorted sources, getter and method sources, if arms around the loop, slice(0, n) windows and show-all toggles, appends, [...this.F].sort(), a single-root conditional.

Cut (one commit each; the tech-debt tracker records the side the important ones now take, not the rare spellings such as a copy around a reorder or slice(0, 0)):

  • nested holders above the shown array (this.trip.tags, object spreads of the holder), and several roots in one conditional
  • ?? / || fallbacks and null clears
  • .concat(x) and spread tails
  • rows that take other if arms (an outer loop row, a @builder run several times, Repeat rows)
  • a copy around a reorder or window ([...this.F.slice(-5)]), slice(0, 0) as a clear
  • the check that nothing reorders after a slice(0, n) window
  • the R4 $$ normalized-text check, which landed with R1 foreach-index-key: index-keyed ForEach over items that change (coverage step 5a) #37 but belongs to input-unbound

Line counts of #37 (additions against its base):

First review (c5a829c) Merged (#37) After this PR
src +317 +900 about +566 (−334)
tests +353 +734 about +495 (−239)

How it was checked

  • npm test and npm run lint in arkui-sem/ after each commit. Each cut removes its own tests; the remaining tests are unchanged apart from dropped spellings.
  • Fixtures and sandbox/demo (heuristic backend): the same findings as main.
  • Offline only: no bench run, no model calls.

Notes for the reviewer

  • Removing cases is the point. Each review thread for these cases can come back as its own small PR if it matters in real code.
  • Commit-by-commit review is easiest. The last commits are a comment rewrap and tech-debt tracker wording.

@bahbyega
bahbyega requested a review from a team as a code owner November 26, 2026 13:12
@bahbyega bahbyega changed the title foreach-index-key: cut review-constructed source shapes (-334 src lines) foreach-index-key: cut review-constructed source shapes Nov 26, 2026
… applies to lazyforeach-source-rebuilt, Repeat rows aren't marked as loops; $$ comment

@ArcsinX ArcsinX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed a118289 (commit-by-commit across all 9 commits).

  • CI (test, test (ubuntu-latest), test (windows-latest)) passed on a118289 (DeepSeek PR Review/review skipped).
  • The code cuts across component.ts, loops.ts, callbacks.ts, syntax.ts, inputs.ts, engine.ts, facts.ts, queries.ts, and R1.ts are clean and internally consistent, and the matching test removals in R1-index.test.ts, loops.test.ts, and R4.test.ts match the cuts.
  • Found a couple of inaccuracies/omissions in docs/exec-plans/tech-debt-tracker.md where the documented behavior doesn't match the compacted code (posted inline).

Comment thread docs/exec-plans/tech-debt-tracker.md Resolved
Comment thread docs/exec-plans/tech-debt-tracker.md Resolved
Comment thread docs/exec-plans/tech-debt-tracker.md Resolved
Comment thread arkui-sem/src/engine.ts Resolved
@devnullexile-deepseek-review

devnullexile-deepseek-review Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 8226a1e)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
✅ Merge recommendation: No concerns found
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected
✅ Resolved findings

arkui-sem/src/engine.ts:383-385

Incorrect $$ fix

Dropping the normalizes flag makes twoWay true when the onChange stores the text normalized, directly (this.q = value.trim()) or through the single handler method it calls (this.setQuery(value.trim())). The input-unbound finding then offers the $$ fix, but $$ binds the raw text, so the suggested edit silently stops trimming (the diff's own comment and the tracker note this). Trigger: a search/text input whose onChange trims its value; the rule recommends a change that alters behavior. The tracker says this belongs to input-unbound, but until that check lands the linter gives wrong advice. Keep the normalizes flag (or an equivalent value.trim()-style check) gating twoWay.

@devnullexile-deepseek-review

devnullexile-deepseek-review Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

DeepSeek review: Approved (8226a1e)

The review found nothing that blocks approval.

This comment is updated on every review. The review comment and its threads have the details.

@ArcsinX ArcsinX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed f1b43db (diff against 7c16784, plus the incremental diff from a118289).

  • CI: all 4 checks (test, test (ubuntu-latest), test (windows-latest), DeepSeek PR Review/review) passed on f1b43db.
  • Prior ArcsinX review threads:
    • Resolved the [...this.a, ...this.b] in-place thread (tech-debt-tracker.md:40) — addressed in f1b43db.
    • Left the other two threads unresolved as they are not addressed yet:
      1. tech-debt-tracker.md:37: shape === 'call' suppression of keepsArray writes and in-place index writes for conditionals/fallbacks.
      2. tech-debt-tracker.md:48: missing entries for the cuts in 5b2e805 ([...this.F.slice(-5)], [...this.F.slice(0, this.n)], this.F.slice(0, 0)) and 496a4be (c ? [...this.F] : []).
  • Code cuts across src/ and test/ remain internally consistent and match CI; noted a few remaining inaccuracies in docs/exec-plans/tech-debt-tracker.md inline (plus the open DeepSeek bot thread on arkui-sem/src/engine.ts:385 regarding $$ on normalized onChange handlers).

Comment thread docs/exec-plans/tech-debt-tracker.md Resolved
Comment thread docs/exec-plans/tech-debt-tracker.md Resolved
Comment thread docs/exec-plans/tech-debt-tracker.md Resolved

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in 8226a1e.

@ArcsinX ArcsinX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Re-reviewed 8226a1e (plus 665a88d):

  • Addressed all three remaining ArcsinX threads on docs/exec-plans/tech-debt-tracker.md — the general no-root rule in 8226a1e accurately matches arkui-sem/src/ets/loops.ts and arkui-sem/src/rules/R1.ts (selection semantics in place, keepsArray suppressed through a method/getter unless reorders, reorders and .slice(0, n) rules still applying). Resolved all three threads.
  • Code cuts and test removals across arkui-sem/src/ and arkui-sem/test/ remain clean and internally consistent.
  • CI (test, test (ubuntu-latest), test (windows-latest)) passed on 8226a1e (DeepSeek PR Review/review still in progress at time of approval).

@bahbyega
bahbyega merged commit 7490f1d into main Nov 26, 2026
4 checks passed
@bahbyega
bahbyega deleted the compact-foreach-index-key branch November 26, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants